package com.example.qxfw.cshx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.qxfw.common.entity.zy.CshxZsyb;
import com.example.qxfw.common.util.DateUtil;
import com.example.qxfw.cshx.mapper.CshxZsybMapper;
import com.example.qxfw.cshx.service.CshxYjcxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;

@Service
public class CshxYjcxServiceImpl implements CshxYjcxService {
    @Autowired
    private CshxZsybMapper cshxZsybMapper;

    @Override
    public List<CshxZsyb> selectByTimePeroid(String start, String end) {
        Timestamp startTime = DateUtil.localDateTimeToTimestamp(DateUtil.stringToLocalDateTime(start));
        Timestamp endTime = DateUtil.localDateTimeToTimestamp(DateUtil.stringToLocalDateTime(end));

        return cshxZsybMapper.selectList(new LambdaQueryWrapper<CshxZsyb>()
        .between(CshxZsyb::getForcastdate, startTime, endTime));
    }
}
